home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / SCSI.h < prev    next >
Text File  |  1991-04-17  |  4KB  |  128 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 10:00 PM
  4.     SCSI.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1986-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __SCSI__
  15. #define __SCSI__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21.  
  22. enum {
  23.  
  24.     scInc = 1,
  25.     scNoInc = 2,
  26.     scAdd = 3,
  27.     scMove = 4,
  28.     scLoop = 5,
  29.     scNop = 6,
  30.     scStop = 7,
  31.     scComp = 8,
  32.     scCommErr = 2,                  /*communications error, operation timeout*/
  33.     scArbNBErr = 3,                 /*arbitration timeout waiting for not BSY*/
  34.     scBadParmsErr = 4,              /*bad parameter or TIB opcode*/
  35.     scPhaseErr = 5,                 /*SCSI bus not in correct phase for attempted operation*/
  36.     scCompareErr = 6,               /*data compare error*/
  37.     scMgrBusyErr = 7,               /*SCSI Manager busy */
  38.     scSequenceErr = 8,              /*attempted operation is out of sequence*/
  39.     scBusTOErr = 9,                 /*CPU bus timeout*/
  40.     scComplPhaseErr = 10,           /*SCSI bus wasn't in Status phase*/
  41.     sbSIGWord = 0x4552,
  42.     pMapSIG = 0x504D
  43. };
  44.  
  45. struct Block0 {
  46.     unsigned short sbSig;           /*unique value for SCSI block 0*/
  47.     unsigned short sbBlkSize;       /*block size of device*/
  48.     unsigned long sbBlkCount;       /*number of blocks on device*/
  49.     unsigned short sbDevType;       /*device type*/
  50.     unsigned short sbDevId;         /*device id*/
  51.     unsigned long sbData;           /*not used*/
  52.     unsigned short sbDrvrCount;     /*driver descriptor count*/
  53.     unsigned long ddBlock;          /*1st driver's starting block*/
  54.     unsigned short ddSize;          /*size of 1st driver (512-byte blks)*/
  55.     unsigned short ddType;          /*system type (1 for Mac+)*/
  56.     unsigned short ddPad[243];      /*ARRAY[0..242] OF INTEGER; not used*/
  57. };
  58.  
  59. typedef struct Block0 Block0;
  60.  
  61. struct Partition {
  62.     unsigned short pmSig;           /*unique value for map entry blk*/
  63.     unsigned short pmSigPad;        /*currently unused*/
  64.     unsigned long pmMapBlkCnt;      /*# of blks in partition map*/
  65.     unsigned long pmPyPartStart;    /*physical start blk of partition*/
  66.     unsigned long pmPartBlkCnt;     /*# of blks in this partition*/
  67.     unsigned char pmPartName[32];   /*ASCII partition name*/
  68.     unsigned char pmParType[32];    /*ASCII partition type*/
  69.     unsigned long pmLgDataStart;    /*log. # of partition's 1st data blk*/
  70.     unsigned long pmDataCnt;        /*# of blks in partition's data area*/
  71.     unsigned long pmPartStatus;     /*bit field for partition status*/
  72.     unsigned long pmLgBootStart;    /*log. blk of partition's boot code*/
  73.     unsigned long pmBootSize;       /*number of bytes in boot code*/
  74.     unsigned long pmBootAddr;       /*memory load address of boot code*/
  75.     unsigned long pmBootAddr2;      /*currently unused*/
  76.     unsigned long pmBootEntry;      /*entry point of boot code*/
  77.     unsigned long pmBootEntry2;     /*currently unused*/
  78.     unsigned long pmBootCksum;      /*checksum of boot code*/
  79.     unsigned char pmProcessor[16];  /*ASCII for the processor type*/
  80.     unsigned short pmPad[188];      /*512 bytes long currently unused*/
  81. };
  82.  
  83. typedef struct Partition Partition;
  84.  
  85. struct SCSIInstr {
  86.     unsigned short scOpcode;
  87.     unsigned long scParam1;
  88.     unsigned long scParam2;
  89. };
  90.  
  91. typedef struct SCSIInstr SCSIInstr;
  92.  
  93.  
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif
  97. pascal OSErr SCSIReset(void)
  98.     = {0x4267,0xA815}; 
  99. pascal OSErr SCSIGet(void)
  100.     = {0x3F3C,0x0001,0xA815}; 
  101. pascal OSErr SCSISelect(short targetID)
  102.     = {0x3F3C,0x0002,0xA815}; 
  103. pascal OSErr SCSICmd(Ptr buffer,short count)
  104.     = {0x3F3C,0x0003,0xA815}; 
  105. pascal OSErr SCSIRead(Ptr tibPtr)
  106.     = {0x3F3C,0x0005,0xA815}; 
  107. pascal OSErr SCSIRBlind(Ptr tibPtr)
  108.     = {0x3F3C,0x0008,0xA815}; 
  109. pascal OSErr SCSIWrite(Ptr tibPtr)
  110.     = {0x3F3C,0x0006,0xA815}; 
  111. pascal OSErr SCSIWBlind(Ptr tibPtr)
  112.     = {0x3F3C,0x0009,0xA815}; 
  113. pascal OSErr SCSIComplete(short *stat,short *message,unsigned long wait)
  114.     = {0x3F3C,0x0004,0xA815}; 
  115. pascal short SCSIStat(void)
  116.     = {0x3F3C,0x000A,0xA815}; 
  117. pascal OSErr SCSISelAtn(short targetID)
  118.     = {0x3F3C,0x000B,0xA815}; 
  119. pascal OSErr SCSIMsgIn(short *message)
  120.     = {0x3F3C,0x000C,0xA815}; 
  121. pascal OSErr SCSIMsgOut(short message)
  122.     = {0x3F3C,0x000D,0xA815}; 
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126.  
  127. #endif
  128.